package com.jdk.study.d2jvm.chapter02;

import sun.misc.Launcher;
import sun.security.ec.CurveDB;

import java.net.URL;
import java.security.Provider;

/**
 * @description:
 * @author: JackLi
 * @date: 2020/4/10 23:58
 */
public class ClassLoader08_ClassLoaderTest1 {

    public static void main(String[] args) {

        System.out.println("********** 启动类加载器 **********");
        // 获取Bootstrap ClassLoader能够加载的API的路径
        URL[] urLs = Launcher.getBootstrapClassPath().getURLs();
        for (URL element : urLs) {
            System.out.println(element.toExternalForm());
        }


        // 从上面的路径中随意选择一个类，来看卡它的类加载器是什么：引导类加载器
        ClassLoader providerClassLoader = Provider.class.getClassLoader();
        System.out.println(providerClassLoader);


        System.out.println("********** 扩展类加载器 **********");
        String extDirs = System.getProperty("java.ext.dirs");
        for (String path : extDirs.split(";")) {
            System.out.println(path);
        }


        // 从上面的路径中随意选择一个类，来看卡它的类加载器是什么：扩展类加载器
        ClassLoader curveDBClassLoader = CurveDB.class.getClassLoader();
        System.out.println(curveDBClassLoader);

    }

}
